﻿using SCG.General;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TTEngine.MapObjects
{
    public class OilVial : MapObject
    {
        //constructor
        public OilVial()
            : base()
        {
            CanTake = true;
            Flamability = 33;
            LootLevel = 0;
        }

        //object name
        public override string ObjectName
        {
            get
            {
                return "Oil Vial";
            }
        }

        //clone
        public override MapObject Clone()
        {
            return new OilVial();
        }

        //image
        public override Bitmap Image
        {
            get
            {
                return Properties.Resources.OilVial;
            }
        }

        //easy to break
        public override bool BreaksWhenStressed(StressType st)
        {
            return true;
        }

        //breaks and burns
        public override void Breaks(DungeonLevel level, int x, int y)
        {
            level.Host.DisplayMessage("The " + DisplayName + " shatters!");
            OilPool oil = new OilPool();
            SCGPoint pt = level.GetSpreadPoint(x, y, "Oil Pool", false);
            if (pt == null)
                pt = new SCGPoint(x, y);
            level.AddObjectToMap(oil, pt.X, pt.Y);
        }
        public override void Burn()
        {
            string s = "The " + DisplayLabel + " explode";
            if (Quantity == 1)
                s += "s";
            s += " into flame!";
            Level.Host.DisplayMessage(s, X, Y);
            Level.Host.SpriteExplodes(this, X, Y);
            Level.RemoveObjectFromMap(this);
            for (int n = 0; n < Quantity; n++)
            {
                OilPool oil = new OilPool();
                SCGPoint pt = Level.GetSpreadPoint(X, Y, "Oil Pool", false);
                if (pt == null)
                    pt = new SCGPoint(X, Y);
                Level.AddObjectToMap(oil, pt.X, pt.Y);
                oil.Burn();
            }
        }
    }
}
